First-in first-out (FIFO) memories provide a temporary buffer (or storage area) between communication systems. A programmable full flag of a FIFO can be used as an interrupt to warn the system when the FIFO buffer becomes almost full, which then blocks further write operations. Almost full flags are generated in real-time to prevent overflow of the buffer. Traditionally, read counters, write counters and an offset register are used to track the status of the FIFO.
Referring to FIG. 1, an almost full flag generation circuit 10 implementing a 3-input adder is shown. The circuit 10 includes a write counter 12, a read counter 14, a program value (i.e., an offset register) 16, a 3-input carry look ahead adder/comparator 18, an adder glitch filter 20 and a programmable almost full flag register 22. The circuit 10 receives a FIFO write clock WRCLK and a FIFO read clock RDCLK. The write counter 12 presents a value to the adder/comprator circuit 18 in response to the FIFO write clock WRCLK. The write counter 12 tracks the number of writes. The read counter 14 presents a value to the adder/comparator circuit 18 in response to the FIFO read clock RDCLK. The read counter 14 tracks the number of reads. The offset register 16 stores a user programmed offset value. The adder/comparator circuit 18 also receives the offset value from the register 16. The adder/comparator 18 presents an output to the programmable almost full register 22 via the adder glitch filter 20. The glitch filter 20 degrades performance of the circuit 10 (i.e., the glitch filter 20 is slow). The programmable almost full register 22 then presents the full status flag FULL. The almost full status flag FULL is obtained by the 3-input adder 18 which is in the critical path. The 3-input adder is slow and restricts the operational speed of the circuit 10.
Conventional almost-full flags that use a 3-input adder define the almost full flag as FULL=(WR−RD>(depth−offset)). Such an approach may have one or more of the following disadvantages of (i) being slow, (ii) consuming large area, and/or (iii) having wide glitches generated by the adder which need filtering, thereby degrading overall performance.